package com.aoxin.service.impl.system;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import com.aoxin.mapper.system.SlfOperateLogMapper;
import com.aoxin.model.system.SlfOperateLog;
import com.aoxin.service.inter.system.OperateLogService;
import com.aoxin.util.ErrorUtil;

@Service("operateLogService")
public class OperateLogServiceImpl implements OperateLogService {

	@Autowired
	private SlfOperateLogMapper slfOperateLogMapper;

	@Override
	@Transactional
	public void insertOperateLog(SlfOperateLog operateLog) {
		Assert.notNull(operateLog, String.format(ErrorUtil.PARAMETER_NULL, "operateLog"));
		this.slfOperateLogMapper.insertSelective(operateLog);
	}

	@Override
	@Transactional
	public void deleteOperateLogs(List<Integer> operateLogIds) {
		Assert.notEmpty(operateLogIds, String.format(ErrorUtil.PARAMETER_NULL, "operateLogIds"));
		this.slfOperateLogMapper.deleteByPrimaryKeys(operateLogIds);
	}

	@Override
	@Transactional
	public void updateOperateLog(SlfOperateLog operateLog) {
		Assert.notNull(operateLog, String.format(ErrorUtil.PARAMETER_NULL, "operateLog"));
		this.slfOperateLogMapper.updateByPrimaryKeySelective(operateLog);
	}

	@Override
	public SlfOperateLog getOperateLog(Integer operateLogId) {
		Assert.notNull(operateLogId, String.format(ErrorUtil.PARAMETER_NULL, "operateLogId"));
		return this.slfOperateLogMapper.selectByPrimaryKey(operateLogId);
	}

	@Override
	public List<SlfOperateLog> getOperateLogList(Map<String, Object> map) {
		return this.slfOperateLogMapper.getList(map);
	}
}
